package com.pikaqiu.warehouse.domain.enums;

import lombok.Getter;
import org.apache.logging.log4j.util.Strings;

@Getter
public enum UserCompanyFlagEnum {

    NORMAL(0, "普通用户"),
    ADMIN(1, "管理员"),
    OWNER(2, "公司拥有者");

    private final Integer code;

    private final String desc;

    UserCompanyFlagEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        for (UserCompanyFlagEnum value : UserCompanyFlagEnum.values()) {
            if (value.code.equals(code)) {
                return value.desc;
            }
        }
        return Strings.EMPTY;
    }
}
